<template>
  <div>
    <!-- 传递动态 cdata 到 Chart 组件 -->
    <Chart :cdata="cdata" />
  </div>
</template>

<script>
import Chart from './chart.vue';

export default {
  props: {
    riskLevels: Array // 让父组件传入 riskLevels
  },
  computed: {
    cdata() {
      return {
        xData: this.riskLevels.map(item => item.text), // 获取风险级别名称
        seriesData: this.riskLevels.map(item => ({
          value: item.number.number[0], // 获取数量
          name: item.text
        }))
      }
    }
  },
  components: {
    Chart
  }
}
</script>
